package com.atguigu.edu.service.client;

import com.atguigu.common.util.R;
import com.atguigu.edu.service.client.imple.VodFileDegradeFeignClient;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @PathVariable 必须补全参数，否则启动报错
 */
@FeignClient(value = "service-vod", fallback = VodFileDegradeFeignClient.class)
@Component
public interface VodClient {
    @PostMapping("/api/vod/upload")
    R upload(MultipartFile file);

    @PostMapping("/api/vod/delete/{videoSourceId}")
    R deleteVideo(@PathVariable("videoSourceId") String videoSourceId);

    //删除多个阿里云视频
    @DeleteMapping("/api/vod/deleteBatch")
    R deleteBatch(@RequestParam("videoIdList") List<String> videoIdList);

    @GetMapping("/api/vod/getPlayInfo/{videoSourceId}")
    R getPlayInfo(@PathVariable("videoSourceId") String videoSourceId);

    //根据视频id获得视频凭证
    @GetMapping("/api/vod/getPlayAuth/{videoSourceId}")
    R getPlayAuth(@PathVariable("videoSourceId") String videoSourceId);



    @GetMapping("/api/vod/test/error")
    R testHystrix(String param);
}
